<!--
 * @Author: CNN 969682281@qq.com
 * @Date: 2023-03-07 13:36:39
 * @LastEditors: 陈妮娜 969682281@qq.com
 * @LastEditTime: 2024-04-26 11:49:13
 * @FilePath: \newMould_BHZ\src\views\WaterManage\trends\instantly.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <!-- 水稳----动态监控---实时监控 -->
  <div class="department" id="department">
    <!-- 左侧部门管理 -->
    <div class="structureTree" v-if="treelength">
      <div class="structureTree_title">
        <div>组织机构</div>
        <div>
          <!-- <el-checkbox v-model="checked" @change="see()">查看下级</el-checkbox> -->
        </div>
      </div>
      <tree
        :treeData="treeData"
        :checkData="checkData"
        nodeKey="fCompanyid"
        @getTreeInfo="handleNodeClick"
        :defaultProps="defaultProps"
      >
      </tree>
    </div>
    <!-- 右侧 -->
    <div class="department_right">
      <!-- 机构名称 -->
      <el-breadcrumb :title="showName"></el-breadcrumb>
      <!-- 顶部导航栏 -->
      <div class="mechanism_nav">
        <!-- 左侧 -->

        <div class="mechanism_nav_left" style="width: 100%">
          <vDatePicker
            :defaultDate="value2"
            @selectPickDate="selectTime"
            width="215px !important"
          >
          </vDatePicker>
          <el-select
            class="selectBhz"
            v-model="getList.stationId"
            placeholder="梁场查询"
            @change="selectBhz"
            style="width: 160px"
          >
            <el-option
              v-for="v in bhzDataList"
              :key="v.fItemName"
              :label="v.fItemName"
              :value="v.fItemValue"
            >
            </el-option>
          </el-select>
          <el-select
            class="selectBhz"
            v-model="getList.machineId"
            placeholder="张拉机查询"
            @change="yj_searchForm(getList)"
            style="width: 160px"
          >
            <el-option
              v-for="v in bhjDataList"
              :key="v.fItemName"
              :label="v.fItemName"
              :value="v.fItemValue"
            >
            </el-option>
          </el-select>
          <el-select
            class="selectBhz"
            style="width: 160px"
            v-model="getList.warningLevel"
            placeholder="超标查询"
            @change="yj_searchForm(getList)"
          >
            <el-option
              v-for="v in exceedList"
              :key="v.fItemName"
              :label="v.fItemName"
              :value="v.fItemValue"
            >
            </el-option>
          </el-select>
          <el-select
            class="selectBhz"
            style="width: 160px"
            v-model="getList.fCloseoperation"
            placeholder="闭合查询"
            @change="yj_searchForm(getList)"
          >
            <el-option
              v-for="v in closeList"
              :key="v.fItemName"
              :label="v.fItemName"
              :value="v.fItemValue"
            >
            </el-option>
          </el-select>

          <input
            type="text"
            placeholder="分部分项查询"
            v-model="getList.keyWord"
          />

          <el-button
            type="primary"
            icon="el-icon-search"
            size="small"
            @click="yj_searchForm(getList)"
          >
            查询
          </el-button>
        </div>
        <!-- 顶部按钮 -->
        <div class="print"></div>
      </div>

      <!-- 表格 -->
      <div class="text_table">
        <tableData
          :height="navigatepageNums > 1 ? 'calc(100% - 50px)' : '100%'"
          :config="table_config"
          :dataList="tableData"
          :loading="listLoading"
          :element-loading-text="listLoadingText"
          @selection-change="selectionChange"
          @sort-change="sortChange"
          @click-change="rowChange"
          @openDialog="yj_viewForm"
          :page="getList.page"
          :pageSize="getList.pageSize"
        />

        <pagination
          :info="queryCriteriaDatas"
          v-if="navigatepageNums > 1"
          :treelength="treelength"
          :total="queryCriteriaDatas.total"
          :pageNum.sync="getList.page"
          :limit.sync="getList.pageSize"
          @pagination="yj_searchForm(getList)"
        />
      </div>

      <!--弹框 列表---查看 -->
      <div class="Control-1 mechanism_dialogS TensionAndGrout_dialog">
        <el-dialog
          title="查看"
          :modal-append-to-body="false"
          v-dialogDrag
          :visible.sync="dialogEditVisible"
          v-loading="loadingEditDialog"
          element-loading-text="详情拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
        >
          <div
            class="dialogBody common"
            style="
               {
                height: '550px';
              }
            "
          >
            <div style="height: 100%">
              <el-table
                :data="tableDataLook"
                :span-method="objectSpanMethod"
                border
                style="width: 100%; height: 100%"
              >
                <el-table-column
                  prop="fNote"
                  label="过程"
                  align="center"
                  width="75"
                >
                  <template slot-scope="scope">
                    <el-button
                      @click="openDialog(scope.row)"
                      @cell-dblclick="openDialog"
                      type="text"
                      size="small"
                      style="padding: 0 !important; margin: 0"
                    >
                      {{ scope.row.fNote }}
                    </el-button>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="fNambername"
                  label="孔号"
                  align="center"
                  width="150"
                >
                </el-table-column>
                <el-table-column
                  prop="fTensioningdates"
                  label="张拉时间"
                  align="center"
                  width="70"
                >
                </el-table-column>
                <el-table-column
                  prop="fMachinename"
                  label="张拉仪"
                  align="center"
                  width="65"
                >
                </el-table-column>
                <el-table-column
                  prop="fRecordproject"
                  label="记录项目"
                  align="center"
                  width="110"
                >
                </el-table-column>
                <el-table-column label="张拉阶段">
                  <el-table-column
                    prop="fOriginalstroke"
                    label="初始行程"
                    align="center"
                    width="70"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="fFirststroke"
                    label="第一行程"
                    align="center"
                    width="70"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="fSecondstroke"
                    label="第二行程"
                    align="center"
                    width="70"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="fThirdstroke"
                    label="第三行程"
                    align="center"
                    width="70"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="fFourthstroke"
                    label="第四行程"
                    align="center"
                    width="70"
                  >
                  </el-table-column>
                </el-table-column>
                <el-table-column
                  prop="fConclusion"
                  label="实测结论"
                  align="center"
                  width="70"
                >
                </el-table-column>
                <el-table-column
                  prop="fDesigntension"
                  label="设计张力(KN)"
                  align="center"
                  width="100"
                >
                </el-table-column>
                <!-- <el-table-column
                  prop="fOvertensionrate"
                  label="超张百分比(%)"
                  align="center"
                  width="110"
                >
                </el-table-column> -->
                <el-table-column
                  prop="fOvertensionrate"
                  label="超张百分比(%)"
                  align="center"
                  width="110"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      :type="scope.row.OvertensionrateBtnType"
                      :class="scope.row.OvertensionrateBtnType"
                    >
                      {{ scope.row.fOvertensionrate }}
                    </el-button>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="fDesignelongation"
                  label="设计伸长量(mm)"
                  align="center"
                  width="115"
                >
                </el-table-column>
                <el-table-column
                  prop="fTotalelongation"
                  label="总伸长量(mm)"
                  align="center"
                  width="110"
                >
                </el-table-column>
                <!-- <el-table-column
                  prop="fElongationdeviation"
                  label="延伸量误差(%)"
                  align="center"
                  width="110"
                >
                </el-table-column> -->
                <el-table-column
                  prop="fElongationdeviation"
                  label="延伸量误差(%)"
                  align="center"
                  width="110"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      :type="scope.row.ElongationdeviationBtnType"
                      :class="scope.row.ElongationdeviationBtnType"
                    >
                      {{ scope.row.fElongationdeviation }}
                    </el-button>
                  </template>
                </el-table-column>

                <!-- <el-table-column
                  prop="fRetraction"
                  label="回缩量(mm)"
                  align="center"
                  width="100"
                >
                </el-table-column> -->
                <el-table-column
                  prop="fRetraction"
                  label="回缩量(mm)"
                  align="center"
                  width="100"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      :type="scope.row.RetractionBtnType"
                      :class="scope.row.RetractionBtnType"
                    >
                      {{ scope.row.fRetraction }}
                    </el-button>
                  </template>
                </el-table-column>
                <!-- <el-table-column
                  prop="fHoldingtime"
                  label="持荷时间(s)"
                  align="center"
                  width="100"
                >
                </el-table-column> -->
                <el-table-column
                  prop="fHoldingtime"
                  label="持荷时间(s)"
                  align="center"
                  width="100"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      :type="scope.row.HoldingtimeBtnType"
                      :class="scope.row.HoldingtimeBtnType"
                    >
                      {{ scope.row.fHoldingtime }}
                    </el-button>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="fWarninglevel"
                  label="预警级别"
                  align="center"
                  width="90"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      :type="scope.row.btnType"
                      :class="scope.row.btnType"
                    >
                      {{ scope.row.fWarninglevelText }}
                    </el-button>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="fHandlesituation"
                  label="断、滑丝及处理情况"
                  align="center"
                  width="140"
                >
                </el-table-column>
              </el-table>
            </div>
          </div>
        </el-dialog>
      </div>
      <!--弹框 过程数据详情---查看 -->
      <div class="Control-1 mechanism_dialogS TensionAndGrout_GC">
        <el-dialog
          title="详情"
          :modal-append-to-body="false"
          v-dialogDrag
          :visible.sync="dialogEditVisibleCon"
          v-loading="loadingEditDialogCon"
          element-loading-text="过程数据拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
        >
          <div
            class="dialogBody common"
            :style="{ height: 'calc(100% - 20px)' }"
          >
            <div class="dialogBodyBox" style="position: relative; height: 55%">
              <tableData
                :height="navigatepageNums_M > 1 ? 'calc(100% - 50px)' : '100%'"
                :config="material_config"
                :dataList="materialData"
                statusType="3"
                :level="level"
                :earlyWarning="earlyWarning"
                :currentRow="false"
                :stripe="false"
              />
              <PaginationS
                :info="queryCriteriaDatas_M"
                v-if="navigatepageNums_M > 1"
                :treelength="treelength"
                :total="queryCriteriaDatas_M.total"
                :pageNum.sync="materialGetList.page"
                :limit.sync="materialGetList.pageSize"
                @pagination="processDetailsFun(materialGetList)"
              />
            </div>
            <hr />
            <div class="dialogBodyBox" style="height: 45%">
              <div class="tab">
                <div
                  v-for="(data, index) in typeData"
                  :key="data.value"
                  @click="changeType($event, index)"
                >
                  <div
                    class="btn"
                    :style="{
                      color:
                        data.show === true ? 'rgba(0, 117, 255, 1)' : '#343639',
                      background: data.show === true ? '#E0EFFF' : '#fff',
                    }"
                  >
                    {{ data.text }}
                  </div>
                </div>
              </div>

              <div class="charts" v-if="typeData[0].show">
                <!-- 张拉力-->
                <tensioningCharts
                  v-loading="chartsLoading"
                  element-loading-text="拼命加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.3)"
                  :time1="this.value2[0]"
                  :time2="this.value2[1]"
                  :commonData="tensioningData"
                  @clickLegend="clickLegend"
                >
                </tensioningCharts>
              </div>

              <div class="charts" v-if="typeData[1].show">
                <!-- 油压 -->
                <pressureCharts
                  v-loading="chartsLoading"
                  element-loading-text="拼命加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.3)"
                  :time1="this.value2[0]"
                  :time2="this.value2[1]"
                  :commonData="pressureData"
                  @clickLegend="clickLegend"
                >
                </pressureCharts>
              </div>
              <div class="charts" v-if="typeData[2].show">
                <!-- 伸长量 -->
                <elongationCharts
                  v-loading="chartsLoading"
                  element-loading-text="拼命加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.3)"
                  :time1="this.value2[0]"
                  :time2="this.value2[1]"
                  :commonData="elongationData"
                  @clickLegend="clickLegend"
                >
                </elongationCharts>
              </div>
              <div class="charts" v-if="typeData[3].show">
                <!-- 顶行程-->
                <tripCharts
                  v-loading="chartsLoading"
                  element-loading-text="拼命加载中"
                  element-loading-spinner="el-icon-loading"
                  element-loading-background="rgba(0, 0, 0, 0.3)"
                  :time1="this.value2[0]"
                  :time2="this.value2[1]"
                  :commonData="tripData"
                  @clickLegend="clickLegend"
                >
                </tripCharts>
              </div>
            </div>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
import vDatePicker from "@/components/public/v-DatePicker"; //时间选择器
import tree from "@/components/TensionAndGrout/tree";
import TableData from "@/components/waterManage/public/el-tables"; //主页面列表
import Pagination from "@/components/public/el-pagination"; //主页面分页
import PaginationS from "@/components/TensionAndGrout/TensionManage/TensionRealTime/el-pagination"; //弹框分页

import elBreadcrumb from "@/components/public/el-breadcrumb.vue"; //面包屑

import pressureCharts from "@/components/TensionAndGrout/TensionManage/TensionRealTime/pressureCharts"; //油压
import tensioningCharts from "@/components/TensionAndGrout/TensionManage/TensionRealTime/tensioningCharts"; //张拉力
import elongationCharts from "@/components/TensionAndGrout/TensionManage/TensionRealTime/elongationCharts"; //伸长量
import tripCharts from "@/components/TensionAndGrout/TensionManage/TensionRealTime/tripCharts"; //伸长量

// import publicForm from "@/components/public/el-form.vue"; //弹框form

import formJs from "./regexDetail.js"; //新增弹框配置项
import {
  getUserCompanyTreeList, //左侧机构树接口
  getTensioningLists, //主页面列表接口
  getTensioningProcess, //主页面列表详情接口
  getTensioningProcessDetailLists, //2级详情接口
  getStationmachineList, //梁场设备查询
  getMachineListByStationId, //4张拉机、5压浆机设备查询
} from "@/api/request.js";
import { statusType2 } from "@/utils/config"; //配置项
// import { statusType } from "@/utils/config"; //配置项   初中高
export default {
  name: "TensionRealTime_Ruicang",
  components: {
    tree, //左侧组织机构数
    TableData, //主页面列表
    elBreadcrumb, //面包屑
    // publicForm, //弹框表格
    Pagination, //分页
    PaginationS,
    vDatePicker, //时间选择器
    pressureCharts, //油石比图表
    tensioningCharts, //温度曲线
    elongationCharts, //伸长量
    tripCharts, //顶行程
  },
  data() {
    return {
      name: "TensionRealTime_Ruicang", //按钮配置页面代号
      exceedList: formJs.exceedList, //顶部下拉框---超标查询
      closeList: formJs.closeList, //顶部下拉框---闭合查询
      bhzDataList: [], //梁场
      bhjDataList: [], //张拉机

      djDataList: formJs.djDataList, //预警级别
      navigatepageNums: null, //是否显示分页
      queryCriteriaDatas: {}, //分页
      value2: "", //主页面日期筛选绑定值

      // 列表配置项
      table_config: formJs.table_config,
      tableData: [], //列表数据列表
      checked: true, //查看下级按钮
      fId: null, //点击当前列表数据fId
      listLoading: false, //列表数据加载loading
      loadingEditDialog: false, //弹框loading
      dialogEditVisible: false, //新增弹框是否显示
      listLoadingText: "", //加载文字
      // 列表给后端传参
      getList: {
        fprojectid: "",
        fCompanyid: "", // 施工标段id，不为空
        startDates: "", // 开始时间
        endDates: "", // 截至时间
        stationId: "", // 梁场id
        machineId: "", // 张拉机id
        warningLevel: "", // 预警等级
        fCloseoperation: "", // 闭合状态
        keyWord: "", //  模糊条件
        page: 1, // 当前页数
        pageSize: 20, // 每页显示条数
        timeStr: "",
        fProjectposition: "", //工程部位模糊查询
        taskNo: "", //任务单模糊查询
        fStatus: "", //状态
        keyType: "1", //张拉 1 压浆 2 必填
        fNote: "1", //新加参数 瑞仓1   其他0
      }, // 列表给后端传参
      falgId: null,
      companyTree: "", //所有数据

      // 左侧机构树
      treelength: false, //左侧树显示隐藏
      showName: "未选择公司",

      treeData: [], //左侧树状图数据
      defaultProps: {
        children: "children",
        label: "fShortname",
      },
      checkData: [],
      userInfo: {}, //登录用户
      treeText: {
        //树状图参数
        companyId: null,
        text: null,
        userId: null,
      },
      // 查看
      tableDataLook: [],
      rowG: null,
      // 查看
      // 详情
      materialRow: null, //选择过程数据当前行数据
      materialGetList: {
        fCompanyid: "",
        namberId: "", // 孔号id
        page: 1, // 当前页码
        pageSize: 10, // 每页显示条数
      }, //调取过程数据详情接口传参
      materialData: [], //列表
      navigatepageNums_M: null, //过程数据-详情-是否显示分页
      queryCriteriaDatas_M: {}, //过程数据-详情-分页
      xlsxName: null, //切换表格时文字
      navigatepageNum: null,
      queryCriteriaData: {}, //分页
      loadingEditDialogCon: false, //弹框loading
      dialogEditVisibleCon: false, //新增弹框是否显示
      typeData: [
        { text: "张拉力", show: true },
        { text: "油压", show: false },
        { text: "伸长量", show: false },
        { text: "顶行程", show: false },
      ],
      tensioningData: [], //张拉力--图表数据
      pressureData: [], //油压--图表数据
      elongationData: [], //伸长量--图表数据
      tripData: [], //顶行程--图表数据
      checkType: {
        全选: false,
        全不选: false,
        油石比: false,
        上限: true,
        下限: true,
        目标: true,
      },
      checkType1: {
        全选: false,
        全不选: false,
        出料温度: false,
        上限: true,
        下限: true,
        目标: true,
      },
      chartsLoading: false,
      level: [],
      earlyWarning: [], //预警标准
      material_config: formJs.material_config, //材料配置项
      // 详情
    };
  },

  mounted() {
    this.userInfo = JSON.parse(sessionStorage.getItem("yjSmart-userInfo"));

    if (JSON.parse(sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists"))) {
      var dataList = JSON.parse(
        sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists")
      );
      this.getList = {
        fprojectid: dataList.fprojectid,
        fCompanyid: dataList.fCompanyid, // 施工标段id，不为空
        startDates: dataList.startDates, // 开始时间
        endDates: dataList.endDates, // 截至时间
        stationId: dataList.stationId, // 梁场id
        machineId: dataList.machineId, // 张拉机id
        warningLevel: dataList.warningLevel, // 预警等级
        fCloseoperation: dataList.fCloseoperation, // 闭合状态
        keyWord: "", //  模糊条件
        page: 1, // 当前页数
        pageSize: 20, // 每页显示条数
        timeStr: dataList.timeStr,
        fProjectposition: dataList.fProjectposition, //工程部位模糊查询
        taskNo: dataList.taskNo, //任务单模糊查询
        fStatus: dataList.fStatus, //状态
        keyType: "1", ////张拉 1 压浆 2 必填
        fNote: "1", //新加参数 瑞仓1   其他0
      };
    }

    if (
      JSON.parse(sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck"))
    ) {
      var id = JSON.parse(
        sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck")
      );
      this.checkData = [id.fCompanyid];
    }

    this.getTree();
    this.getDate();

    // this.btnRole(this.name);

    this.table_config.thead[7]["callback"] = function (rowData) {
      let data = statusType2[rowData.fWarninglevel];
      if (data) {
        return data.label;
      }
    };
    this.table_config.thead[7]["specialClass"] = function (rowData) {
      let data = statusType2[rowData.fWarninglevel];
      if (data) {
        return data.className;
      }
    };

    this.table_config.operation.cols = [
      {
        label: "查看",
        type: "primary",
        handleRow: this.handleRow,
      },
    ];
  },
  methods: {
    btnRole(name) {
      // 按钮权限
      var btnList = [];
      var ModuleList = JSON.parse(sessionStorage.getItem("yjSmart-instantly"));
      if (ModuleList.length > 0) {
        ModuleList.map((item) => {
          if (item.fEncode == name) {
            btnList = item.modulebuttonList;
          }
        });
        var btnStr = [];
        btnList.map((item) => {
          btnStr.push(item.fEncode);
        });
        // this.yj_view = btnStr.includes("yj_view");
      } else {
        // this.yj_view = true;
      }
    },
    // 左侧树结构
    getTree() {
      this.treeText = {
        companyId: this.userInfo.companyId,
        userId: this.userInfo.userId,
        text: "4", // 0其他  1 砼拌合站 2水稳 3沥青
      };
      getUserCompanyTreeList(this.treeText)
        .then((res) => {
          if (res.errcode == 0) {
            var companyTree = res.data.userCompanyTreeList;
            this.treeData = this.commonJs.tranListToTreeData(companyTree);
            if (this.treeData[0].children == undefined) {
              this.treelength = false; //左侧组织机构是否显示
            } else {
              this.treelength = true;
            }

            if (this.checkData[0]) {
              this.showName = JSON.parse(
                sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck")
              ).fShortname;

              this.getList.fCompanyid = this.checkData[0];
            } else {
              this.checkData[0] = this.treeData[0].fCompanyid;
              this.showName = this.treeData[0].fShortname; //当前点击组织机构名称
              this.getList.fCompanyid = this.treeData[0].fCompanyid; //当前点击组织机构ID
            }
            this.mixingPlantList(0, this.getList);
            this.yj_searchForm(this.getList); // 调用主页面列表接口
            // 列表
          } else {
            this.$message.error(res.msg);
            // this.$message.error("获取组织机构失败");
            return false;
          }
        })
        .catch(() => {
          return false;
        });
    },
    // 点击左侧机构树
    handleNodeClick(data) {
      this.showName = data.fShortname; //顶部显示机构名
      if (JSON.parse(sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists"))) {
        var getListData = JSON.parse(
          sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists")
        );
        this.getList = {
          fprojectid: getListData.fprojectid,
          fCompanyid: data.fCompanyid, // 施工标段id，不为空
          startDates: getListData.startDates, // 开始时间
          endDates: getListData.endDates, // 截至时间
          stationId: "", // 梁场id
          machineId: "", // 张拉机id
          warningLevel: getListData.warningLevel, // 预警等级
          fCloseoperation: getListData.fCloseoperation, // 闭合状态
          keyWord: getListData.keyWord, //  模糊条件
          page: 1, // 当前页数
          pageSize: 20, // 每页显示条数
          timeStr: getListData.timeStr, //趋势年份
          fProjectposition: getListData.fProjectposition, //工程部位模糊查询
          taskNo: getListData.taskNo, //任务单模糊查询
          fStatus: getListData.fStatus, //状态
          keyType: "1", ////张拉1 压浆2 必填
          fNote: "1", //新加参数 瑞仓1   其他0
        };
        this.value2 = [this.getList.startDates, this.getList.endDates];
      } else {
        this.getList = {
          fprojectid: "",
          fCompanyid: data.fCompanyid, // 施工标段id，不为空
          startDates: this.common.getDay(-6) + " " + "00:00:00", // 开始时间
          endDates: this.common.getDay(0) + " " + "23:59:59", // 截至时间
          stationId: "", // 梁场id
          machineId: "", // 张拉机id
          warningLevel: "", // 预警等级
          fCloseoperation: "", // 闭合状态
          keyWord: "", //  模糊条件
          page: 1, // 当前页数
          pageSize: 20, // 每页显示条数
          timeStr: "",
          fProjectposition: "", //工程部位模糊查询
          taskNo: "", //任务单模糊查询
          fStatus: "", //状态
          keyType: "1", ////张拉1 压浆2 必填
          fNote: "1", //新加参数 瑞仓1   其他0
        };
        this.value2 = [
          this.common.getDay(-6) + " " + "00:00:00",
          this.common.getDay(0) + " " + "23:59:59",
        ];
      }

      this.mixingPlantList(0, this.getList);
      this.yj_searchForm(this.getList);
    },
    // 点击图表切换
    changeType(e, index) {
      for (let i in this.typeData) {
        if (parseFloat(i) === index) {
          this.typeData[i].show = true;
        } else {
          this.typeData[i].show = false;
        }
      }
      this.typeDataNum = index;
    },

    // 获取列表数据
    yj_searchForm(data) {
      this.listLoading = true;
      this.tableData = [];
      if (this.getList.warningLevel == "==请选择==") {
        data.warningLevel = "";
      }
      if (this.getList.fCloseoperation == "==请选择==") {
        data.fCloseoperation = "";
      }
      if (this.getList.machineId == "所有张拉机") {
        data.machineId = "";
      }
      if (this.getList.stationId == "所有梁场") {
        data.stationId = "";
      }

      window.sessionStorage.setItem(
        "yjSmart-TensionManage_Ruicang_getLists",
        JSON.stringify(data)
      );

      var getList = {
        fCompanyid: data.fCompanyid, // 施工标段id，不为空
        startDates: data.startDates, // 开始时间
        endDates: data.endDates, // 截至时间
        machineId: data.machineId, // 张拉机id
        stationId: data.stationId, // 梁场id
        warningLevel: data.warningLevel, // 预警等级
        fCloseoperation: data.fCloseoperation, // 闭合状态
        keyWord: data.keyWord, //  模糊条件
        page: data.page, // 当前页数
        pageSize: 20, // 每页显示条数
        fNote: "1", //新加参数 瑞仓1   其他0
      };
      getTensioningLists(getList)
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            that.listLoading = false;
            that.tableData = res.data.pageInfo.list;
            that.queryCriteriaDatas = res.data.pageInfo; //分页信息
            that.navigatepageNums =
              that.queryCriteriaDatas.navigatepageNums.length;
          } else {
            this.$message.error("获取 列表数据失败", res.msg);
            this.listLoading = false;
          }
        })
        .catch((error) => {
          this.$message.error("获取列表数据 接口报错", error.msg);
          this.listLoading = false;
        });
    },

    // 查看
    yj_viewForm(row) {
      this.rowG = row;

      if (row.fBeamid != "" && row.fBeamid != null) {
        this.fPhotofilelist = [];
        this.tableDataLook = [];
        this.loadingEditDialog = true;
        this.dialogEditVisible = true;
        getTensioningProcess({
          fCompanyid: row.fCompanyid,
          beamId: row.fBeamid,
        })
          .then((res) => {
            if (res.errcode == 0) {
              var that = this;
              that.loadingEditDialog = false;
              // that.dialogEditVisible = true;
              that.tableDataLook = res.data.tensioningProcess;
              that.tableDataLook.map((item) => {
                // 预警级别
                if (item.fWarninglevel == 0) {
                  item.fWarninglevelText = "正常";
                  item.btnType = "success";
                } else if (item.fWarninglevel == 1) {
                  item.fWarninglevelText = "一级";
                  item.btnType = "plain";
                } else if (item.fWarninglevel == 2) {
                  item.fWarninglevelText = "二级";
                  item.btnType = "warning";
                } else if (item.fWarninglevel == 3) {
                  item.fWarninglevelText = "三级";
                  item.btnType = "danger";
                } else if (item.fWarninglevel == 4) {
                  item.fWarninglevelText = "四级";
                  item.btnType = "purple";
                }
                // 超张百分比
                if (item.fOvertensionratewarninglevel == 0) {
                  item.OvertensionrateBtnType = "success";
                } else if (item.fOvertensionratewarninglevel == 1) {
                  item.OvertensionrateBtnType = "plain";
                } else if (item.fOvertensionratewarninglevel == 2) {
                  item.OvertensionrateBtnType = "warning";
                } else if (item.fOvertensionratewarninglevel == 3) {
                  item.OvertensionrateBtnType = "danger";
                } else if (item.fOvertensionratewarninglevel == 4) {
                  item.OvertensionrateBtnType = "purple";
                }
                //延伸量误差
                if (item.fElongationdeviationwarninglevel == 0) {
                  item.ElongationdeviationBtnType = "success";
                } else if (item.fElongationdeviationwarninglevel == 1) {
                  item.ElongationdeviationBtnType = "plain";
                } else if (item.fElongationdeviationwarninglevel == 2) {
                  item.ElongationdeviationBtnType = "warning";
                } else if (item.fElongationdeviationwarninglevel == 3) {
                  item.ElongationdeviationBtnType = "danger";
                } else if (item.fElongationdeviationwarninglevel == 4) {
                  item.ElongationdeviationBtnType = "purple";
                }
                // 回缩量
                if (item.fRetractionwarninglevel == 0) {
                  item.RetractionBtnType = "success";
                } else if (item.fRetractionwarninglevel == 1) {
                  item.RetractionBtnType = "plain";
                } else if (item.fRetractionwarninglevel == 2) {
                  item.RetractionBtnType = "warning";
                } else if (item.fRetractionwarninglevel == 3) {
                  item.RetractionBtnType = "danger";
                } else if (item.fRetractionwarninglevel == 4) {
                  item.RetractionBtnType = "purple";
                }
                // 持荷时间
                if (item.fHoldingtimewarninglevel == 0) {
                  item.HoldingtimeBtnType = "success";
                } else if (item.fHoldingtimewarninglevel == 1) {
                  item.HoldingtimeBtnType = "plain";
                } else if (item.fHoldingtimewarninglevel == 2) {
                  item.HoldingtimeBtnType = "warning";
                } else if (item.fHoldingtimewarninglevel == 3) {
                  item.HoldingtimeBtnType = "danger";
                } else if (item.fHoldingtimewarninglevel == 4) {
                  item.HoldingtimeBtnType = "purple";
                }
              });
            } else {
              this.$message.error(res.msg);
              this.loadingEditDialog = false;
            }
          })
          .catch((error) => {
            this.$message.error(error.msg);
            this.loadingEditDialog = false;
          });
      } else {
        return this.$message.error("请先选择需要查看的数据");
      }
    },

    // 点击详情列表---过程数据
    openDialog(row) {
      this.materialRow = row;
      this.materialGetList = {
        fCompanyid: this.rowG.fCompanyid,
        namberId: row.fNamberid, // 孔号id
        page: 1, // 当前页码
        pageSize: 10, // 每页显示条数
      };
      this.processDetailsFun(this.materialGetList);
      //这里加过程数据接口
    },
    // 过程数据详情
    processDetailsFun(data) {
      if (this.materialRow.fId != "" && this.materialRow.fId != null) {
        this.fPhotofilelist = [];
        this.materialData = [];
        this.tensioningData = [];
        this.pressureData = [];
        this.elongationData = [];
        this.tripData = [];

        this.loadingEditDialogCon = true;
        this.dialogEditVisibleCon = true;
        getTensioningProcessDetailLists(data)
          .then((res) => {
            if (res.errcode == 0) {
              var that = this;
              that.loadingEditDialogCon = false;
              // that.dialogEditVisibleCon = true;
              that.materialData = res.data.pageInfo.list;
              that.queryCriteriaDatas_M = res.data.pageInfo; //分页信息
              that.navigatepageNums_M =
                that.queryCriteriaDatas_M.navigatepageNums.length;
              that.tensioningData = [
                res.data.line.recorddatesList,
                res.data.line.force1List,
                res.data.line.force2List,
              ]; //张拉力--图表数据
              that.pressureData = [
                res.data.line.recorddatesList,
                res.data.line.pressure1List,
                res.data.line.pressure2List,
              ]; //油压--图表数据
              that.elongationData = [
                res.data.line.recorddatesList,
                res.data.line.elongation1List,
                res.data.line.elongation2List,
              ]; //伸长量--图表数据
              that.tripData = [
                res.data.line.recorddatesList,
                res.data.line.topstroke1List,
                res.data.line.topstroke2List,
              ]; //顶行程--图表数据
            } else {
              this.$message.error(res.msg);
              this.loadingEditDialogCon = false;
            }
          })
          .catch((error) => {
            this.$message.error(error.msg);
            this.loadingEditDialogCon = false;
          });
      } else {
        return this.$message.error("请先选择需要查看的数据");
      }
    },
    clickLegend() {},
    // 点击当前行
    rowChange(val) {
      return val;
    },

    // 获取梁场数据
    mixingPlantList(num, datas) {
      var data = {
        companyId: datas.fCompanyid, // 施工标段id
        modelType: num, // 类型
        stationType: "4", // 拌合站类型
      };
      this.bhzDataList = [
        {
          fItemName: "所有梁场",
          fItemValue: "",
        },
      ];
      getStationmachineList(data)
        .then((res) => {
          if (res.errcode == 0) {
            var arr = res.data.stationmachineList;

            arr.map((item) => {
              this.bhzDataList.push({
                fItemName: item.fMachinename,
                fItemValue: item.fMachineid,
              });
            });
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    selectBhz(e) {
      this.getList.machineId = "";
      this.getList.stationId = e;
      this.getbhjDataMethods(e, "4");
      this.yj_searchForm(this.getList);
    },
    // 获取张拉机设备
    getbhjDataMethods(data, num) {
      this.bhjDataList = [
        {
          fItemName: "所有张拉机",
          fItemValue: "",
        },
      ];
      getMachineListByStationId({ stationId: data, modelType: num })
        .then((res) => {
          if (res.errcode == 0) {
            var arr = res.data.stationmachineList;

            arr.map((item) => {
              this.bhjDataList.push({
                fItemName: item.fMachinename,
                fItemValue: item.fMachineid,
              });
            });
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    // 查看列表---行合并
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (
        columnIndex === 0 ||
        columnIndex === 1 ||
        columnIndex === 2 ||
        columnIndex === 19
      ) {
        if (rowIndex % 6 === 0) {
          return {
            rowspan: 6,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      } else if (
        columnIndex === 3 ||
        columnIndex === 11 ||
        columnIndex === 12 ||
        columnIndex === 13 ||
        columnIndex === 14 ||
        columnIndex === 15 ||
        columnIndex === 16 ||
        columnIndex === 17 ||
        columnIndex === 18
      ) {
        if (rowIndex % 3 === 0) {
          return {
            rowspan: 3,
            colspan: 1,
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0,
          };
        }
      }
      return row, column, rowIndex, columnIndex;
    },
    // 时间间隔
    selectTime(e) {
      if (e[0] != "" && e[1] != "") {
        this.getList.startDates = e[0] + " " + "00:00:00"; // 开始时间
        this.getList.endDates = e[1] + " " + "23:59:59"; // 截至时间
      } else {
        this.getList.startDates = ""; // 开始时间
        this.getList.endDates = ""; // 截至时间
      }
      this.yj_searchForm(this.getList);
    },

    getDate() {
      if (JSON.parse(sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists"))) {
        var dataList = JSON.parse(
          sessionStorage.getItem("yjSmart-TensionManage_Ruicang_getLists")
        );
        this.getList = {
          fprojectid: dataList.fprojectid,
          fCompanyid: dataList.fCompanyid, // 施工标段id，不为空
          startDates: dataList.startDates, // 开始时间
          endDates: dataList.endDates, // 截至时间
          stationId: dataList.stationId, // 梁场id
          machineId: dataList.machineId, // 张拉机id
          warningLevel: dataList.warningLevel, // 预警等级
          fCloseoperation: dataList.fCloseoperation, // 闭合状态
          keyWord: "", //  模糊条件
          page: 1, // 当前页数
          pageSize: 20, // 每页显示条数
          timeStr: dataList.timeStr,
          fProjectposition: dataList.fProjectposition, //工程部位模糊查询
          taskNo: dataList.taskNo, //任务单模糊查询
          fStatus: dataList.fStatus, //状态
          keyType: "1", ////张拉 1 压浆 2 必填
          fNote: "1", //新加参数 瑞仓1   其他0
        };
        this.value2 = [this.getList.startDates, this.getList.endDates];
        this.xlsxName =
          this.getList.startDates +
          "至" +
          this.getList.endDates +
          "张拉实时数据";
      } else {
        this.getList.startDates = this.common.getDay(-6) + " " + "00:00:00"; // 开始时间
        this.getList.endDates = this.common.getDay(0) + " " + "23:59:59"; // 截至时间

        this.xlsxName =
          this.common.getDay(-6) +
          "至" +
          this.common.getDay(0) +
          " " +
          "23:59:59" +
          "张拉实时数据";

        this.value2 = [
          this.common.getDay(-6) + " " + "00:00:00",
          this.common.getDay(0) + " " + "23:59:59",
        ];
      }
    },
    // 多选方法
    selectionChange() {},
    // 排序方法
    sortChange() {},
  },
};
</script>


<style scoped lang='less'>
.printTables {
  background: #fff;
  display: flex;
  justify-content: end;
  padding: 5px;
  margin-top: 10px;
}

.dialogBody {
  padding: 3px 20px;
  height: 98%;
  /* overflow-y: auto; */
  .dialogBodyBox {
    width: 100%;
    .tab {
      display: flex;
      font-size: 14px;
      height: 30px;
      line-height: 30px;
      box-sizing: border-box;
      border-bottom: 2px solid #e4e7ed;
      padding: 0 0.16rem;

      .btn {
        margin-top: 4px;
        // margin-right: 16px;
        width: 80px;
        height: 24px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-top-right-radius: 4px;
        border-top-left-radius: 4px;
      }
    }

    .charts {
      height: calc(100% - 30px);
    }
  }
}

.mechanism_dialogS /deep/ .el-table__body-wrapper {
  height: calc(100% - 84px);
  overflow-y: auto;
}
.mechanism_dialogS /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  width: 10px; //调纵向滚动条显示隐藏
  height: 10px; //调横向滚动条显示隐藏
  z-index: 99999999 !important;
}

// .dialogBody {
//   height: 98% !important;
// }
.common .block {
  bottom: 5px !important;
}
.Control-1 /deep/ .el-table .cell {
  height: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
</style>


